package com.example.d01线程的实现.testRunnable;

import java.util.concurrent.RunnableFuture;

public class test2 implements Runnable{
    public int ps=10;


    @Override
    public void run() {
        while (true){
            if(ps<=0){
                break;
            }else {
                System.out.println(Thread.currentThread().getName()+"拿了"+ps);
                ps--;
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) {
        test2 te=new test2();
        new Thread(te,"1号").start();
        new Thread(te,"2号").start();
        new Thread(te,"3号").start();
    }
}
